package com.zheng.study.company.dao.impl;

import com.zheng.study.base.dao.impl.BaseDaoImpl;
import com.zheng.study.company.dao.UserDao;
import com.zheng.study.company.entity.User;
import org.springframework.stereotype.Repository;
import org.springframework.util.Assert;

/**
 * newFile
 * ============================================================================
 * author : dzw
 * createDate:  2018/8/20 。
 * ============================================================================
 */
@Repository
public class UserDaoImpl extends BaseDaoImpl<User, String> implements UserDao {

	public User getUserByAdminId(String adminId) {
		Assert.hasText(adminId, "adminId is required");
		String hql = "from " + User.class.getName() + " u where u.adminId = :adminId";
		return (User) getSession().createQuery(hql).setParameter("adminId", adminId).uniqueResult();
	}

}
